fix(aqua): strip aqua asset formats from AssetWithoutExt#10104
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors asset format detection and extension stripping in the aqua-registry crate, and updates the Windows extension completion logic in the aqua backend to ignore version numbers when detecting existing extensions. This prevents issues like duplicate extensions on files containing version dots. Feedback on these changes highlights opportunities to optimize string allocations in asset_without_ext, improve robustness in path_ext_ignoring_version by operating only on the filename rather than the entire path, and remove the redundant aqua_file_src helper function.
Greptile SummaryThis PR fixes
Confidence Score: 5/5Safe to merge — the change is a focused, well-tested refactor of a format-stripping helper with no effect on extraction dispatch or HTTP behaviour. The new asset_without_ext uses find_map over a shared constant whose ordering correctly places compound suffixes (tar.gz) before their single-component parts (gz), so no existing format is mis-stripped. The motivating .zst bug is fixed and covered by a new test, and the old hard-coded chain's missing formats (.dmg, .pkg, .lz4, etc.) are all included. No files require special attention. Important Files Changed
Reviews (19): Last reviewed commit: "Merge branch 'main' into fix/aqua-window..." | Re-trigger Greptile |
a47734e to
eef1558
Compare
29619af to
d375c28
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR centralizes asset format detection and archive extension handling in the aqua-registry. A new shared constant and helper function replace inline suffix matching logic in ChangesAsset Format and Extension Handling Centralization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
This comment was marked as outdated.
This comment was marked as outdated.
972b5ef to
ca30edf
Compare
ca30edf to
f37e519
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/aqua-registry/src/types.rs`:
- Around line 1428-1448: The test
test_remove_ext_from_asset_uses_aqua_asset_formats is missing assertions for the
shorthand tar-based suffixes; update that test to add assertions calling
remove_ext_from_asset for filenames ending with .tbr, .tlz4, and .tsz and assert
they normalize to ("name", "tar.br"), ("name", "tar.lz4"), and ("name",
"tar.zst") respectively (e.g., "tool.tbr" -> ("tool","tar.br"), "tool.tlz4" ->
("tool","tar.lz4"), "tool.tsz" -> ("tool","tar.zst")); keep the test name and
placement and follow the same assert_eq! style as the other cases so the
normalization behavior is covered.
- Around line 891-898: normalize_asset_format currently maps
"tgz","txz","tbz","tbz2" but misses other tar-based shorthands present in
AQUA_ASSET_FORMATS; update the normalize_asset_format function to also map "tbr"
-> "tar.br", "tlz4" -> "tar.lz4", and "tsz" -> "tar.sz" so downstream checks
like format.starts_with("tar") (used in install logic) correctly route these
archives to the untar handler.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 7afc5978-0a73-4902-85d7-6cb6c06db3f0
📒 Files selected for processing (2)
crates/aqua-registry/src/types.rse2e-win/backend/aqua_bin_path.Tests.ps1
|
This PR currently has merge conflicts. If this continues for 7 days, it will be closed automatically. This is warning day 1 of 7. Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it. This comment was generated by an automated workflow. |
a9e6b11 to
4dcbca2
Compare
|
This PR currently has failing checks. If this continues for 7 days, it will be closed automatically. This is warning day 1 of 7. Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it. This comment was generated by an automated workflow. |
|
This PR currently has failing checks. If this continues for 7 days, it will be closed automatically. This is warning day 2 of 7. Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it. This comment was generated by an automated workflow. |
|
This PR currently has failing checks. If this continues for 7 days, it will be closed automatically. This is warning day 3 of 7. Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it. This comment was generated by an automated workflow. |
|
This PR currently has failing checks. If this continues for 7 days, it will be closed automatically. This is warning day 4 of 7. Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it. This comment was generated by an automated workflow. |
|
This PR currently has failing checks. If this continues for 7 days, it will be closed automatically. This is warning day 5 of 7. Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it. This comment was generated by an automated workflow. |
|
This PR currently has failing checks and merge conflicts. If this continues for 7 days, it will be closed automatically. This is warning day 6 of 7. Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it. This comment was generated by an automated workflow. |
4dcbca2 to
5bbfc4c
Compare
5bbfc4c to
ba605d5
Compare
Summary
{{.AssetWithoutExt}}with aqua's full asset suffix list instead of a short hard-coded strip chainStack
Stacked on #10404. Target branch remains
main.Context
This reworks #10104 on top of the aqua format-alias cleanup in #10404 after PR 1 (
feat(file): support tbz extraction format alias) was merged.AssetWithoutExtshould follow aqua asset filename semantics. The previous implementation stripped common archive suffixes such as.tar.gz,.zip, and.gz, but missed aqua-known suffixes like.zst. That matters for packages such asopenai/codex, where the registry can render an asset likecodex-x86_64-pc-windows-msvc.exe.zstand use{{.AssetWithoutExt}}as the file source. Without this change, mise looks for the.zstpath instead of the decompressed.exepath.This PR deliberately does not change extraction dispatch, HTTP cache behavior, or unsupported-format policy. Those are split into later PRs in the project plan.
Tests
cargo fmt --checkmise x cargo -- cargo test -p aqua-registry test_aqua_file_src_asset_without_ext_strips_zstmise x cargo -- cargo test -p aqua-registry test_asset_without_ext_uses_aqua_asset_formatsmise x cargo -- cargo test -p aqua-registry test_format_detects_literal_aqua_aliasesmise x cargo -- cargo test -p aqua-registry test_format_preserves_explicit_aqua_aliasesSummary by CodeRabbit
Refactor
Tests